import {Node,Graph} from '@antv/x6'
import svg from './svg/非门.svg'

Graph.registerNode(
  'FeiGate',
  {
    inherit: 'image',
    width: 80,
    height: 80,
    markup: [
      {
        tagName: 'image',
        selector: 'img',
      },
    ],
    attrs: {
      img: {
        xlinkHref:svg,
        width: 16,
        height: 16,
        x: 0,
        y: 0,
      },
    },
    ports: {
      groups: {
        port1:{
          position:{
            name:"absolute",
            args:{x:'50%',y:12}
          },
          attrs:{
            circle:{
              magnet:true,
              stroke:'#8f8f8f',
              r:5,
              style: {
                visibility: 'hidden'
              }
            }
          }
        },
        port2:{
          position:{
            name:"bottom",
            args:{dy:-16}
          },
          attrs:{
            circle:{
              magnet:true,
              stroke:'#8f8f8f',
              r:5,
              style: {
                visibility: 'hidden'
              }
            }
          }
        },
      },
    },
  },
  true,
)



/**数据库节点 */
export const FeiGate: Node.Metadata = {
  shape: 'FeiGate',   //对应上面注册的 name
  attrs: {
    body: {
      refPoints: '10,0 40,0 30,20 0,20'
    },

  },
  ports: {
    items: [
      {
        id: 'port_1',
        group: 'port1',
      },
      {
        id: 'port_2',
        group: 'port2',
      },
    ],
  },
}
